/*
 * Copyright (c) 2015-2018 Sfkj Science And Technology Co.,Ltd.
 * All Rights Reserved.
 * This software is the confidential and proprietary information of
 * Sfkj Science And Technology Co.,Ltd.
 * ("Confidential Information").You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Sfkj.
 */
package com.sfkj.walk.aliyun.oss;

import lombok.Data;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

@Data
public class UploadFile implements java.io.Serializable {

    private String originalFilename;
    private String contentType;
    private String contentMd5;
    private String contentDisposition;
    private long size;
    private byte[] bytes;
    private InputStream inputStream;

    private String fileName;
    private String fullFileName;
    private String url;
    private Map<String, String> metadata = new HashMap<>();

    public String getFileType() {
        return originalFilename.substring(originalFilename.lastIndexOf("."));
    }

    public String generateFileType(String newFilename) {
        return newFilename + getFileType();
    }

    public Map<String, String> putMetaData(String key, String value) {
        metadata.put(key, value);
        return this.metadata;
    }

}
